Skip to content

code-mode: make pending frontiers generation-resumable#29399

Closed
cconger wants to merge 1 commit into
cconger/code-mode-runtime-compact-03f-create-observe-runtimefrom
cconger/code-mode-runtime-compact-03f1-pending-generations
Closed

code-mode: make pending frontiers generation-resumable#29399
cconger wants to merge 1 commit into
cconger/code-mode-runtime-compact-03f-create-observe-runtimefrom
cconger/code-mode-runtime-compact-03f1-pending-generations

Conversation

@cconger

@cconger cconger commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Why

A pausable cell needs a stable pending frontier. Repeated observation must return the same frontier without advancing execution, and resume must target the exact frontier the caller observed.

What

  • Give each pending frontier a monotonic PendingGeneration.
  • Require the generation when resuming a pausable cell.
  • Return AlreadyRunning for an already-consumed generation and reject a future generation.
  • Derive pending tool-call IDs from the actor's authoritative resolver map.
  • Preserve an unobserved frontier across repeated waits and runtime failure.
  • Cover parallel calls resolved one at a time.

Stack boundary

This PR establishes generation-safe pausing inside SessionRuntime. Continuing and pausable cells still share too much of the Rust type surface here; #29400 separates their capabilities. This is not yet a host/core protocol change.

Validation

  • just test -p codex-code-mode
  • Regressions cover repeated pending observations, stale and future resume generations, runtime loss, and parallel outstanding tool calls.

Stack parent: #29290.

@cconger cconger force-pushed the cconger/code-mode-runtime-compact-03f1-pending-generations branch from b140ec7 to 8eac740 Compare June 22, 2026 06:48
last_resumed_generation = Some(generation);
runtime_paused = false;
let _ = runtime_control_tx
.send(RuntimeControlCommand::Continue);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we only consume the frontier after Continue is successfully sent?
If the runtime has already dropped control_rx, this currently clears the frontier and returns Resumed even though execution never resumed

@cconger cconger closed this Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants